package me.helllp.bootman.back.config;

import me.helllp.bootman.common.base.BaseReturn;
import me.helllp.bootman.common.base.ErrorCodeEnum;

/**
 * 定义所有逻辑的返回错误编码
 * 
 * @author Administrator
 *
 */
public enum BackErrorCodeEnum {

	SYS_LOGIN_01(ErrorCodeEnum.USER_DEFINE + 1, 			"验证用户名密码错误"),
	
	
	;
	
	private int code;
	
	private String msg;
	
	BackErrorCodeEnum(int code, String msg){
		this.code = code;
		this.msg = msg;
	}
	
	public int getCode() {
		return this.code;
	}
	
	public String getMsg(){
		return this.msg;
	}
	
    public static BackErrorCodeEnum getByValue(int value) { 
        for(BackErrorCodeEnum e : BackErrorCodeEnum.values()) {  
        	if(e.code == value){
        		return e;
        	}
        }      	
        return null;  
    } 
    
    /**
     * 根据当前的错误码产生返回结构
     * 
     * @return
     */
    public BaseReturn getResult(){
    	return new BaseReturn(this.code, this.msg, null);
    }
}
